﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using ViewModels.Shared;

namespace ViewModels.User
{
    public class RegisterModel: PhoneModel, INameModel, ICaptchaModel
    {
        public string Captcha { get; set; }

        [RegularExpression("[0-9]+-[0-9]{4}", ErrorMessage = "* 邀请码格式错误")]
        [Required(ErrorMessage = "* 不能为空")]
        public string InviteCode { get; set; }

        [MaxLength(20, ErrorMessage = "* 用户名长度不超过20个字符")]
        public string LogonName { get; set; }

        [MaxLength(20, ErrorMessage = "* 昵称长度不超过20个字符")]
        public string NickName { get; set; }

        [StringLength(20, MinimumLength = 6, ErrorMessage = "* 密码长度至少为6位")]
        public string Password { get; set; }

        [System.ComponentModel.DataAnnotations.Compare(
            "Password", ErrorMessage = "* 确认密码和密码不一致")]
        public string ConfirmPassword { get; set; }
    }

    public class _ChangePwdModel
    {
        [Required(ErrorMessage = "* 旧密码不能为空")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "* 密码长度至少为6位")]
        public string OldPassword { get; set; }

        [Required(ErrorMessage = "* 新密码不能为空")]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "* 密码长度至少为6位")]
        public string Password { get; set; }

        [Required(ErrorMessage = "* 确认密码不能为空")]
        [System.ComponentModel.DataAnnotations.Compare(
            "Password", ErrorMessage = "* 确认密码和密码不一致")]
        public string ConfirmPassword { get; set; }

    }
}
